package com.agua.enturno.servicios.impl;

import com.agua.enturno.persistencia.dao.AdministradorDeAgendaDAO;
import com.agua.enturno.servicios.AdministradorDeAgendaService;
import com.agua.enturno.vista.dto.AdministradorDeAgendaDTO;
import com.agua.enturno.vista.dto.AgendaDTO;
import com.agua.enturno.vista.dto.assemblers.AdministradorDeAgendaAssembler;
import com.agua.enturno.vista.dto.assemblers.AgendaAssembler;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public class AdministradorDeAgendaServiceImpl implements AdministradorDeAgendaService {

	private AdministradorDeAgendaDAO administradorDeAgendaDAO;
	private AdministradorDeAgendaAssembler administradorDeAgendaAssembler;
	private AgendaAssembler agendaAssembler;
	
	
	/*------------------------------------ Public methods ----------------------------------*/

	@Override
	@Transactional
	public AdministradorDeAgendaDTO findById(Long id) {
		return administradorDeAgendaAssembler.assemble(administradorDeAgendaDAO.findById(id));
	}
	
	@Override
	@Transactional
	public List<AgendaDTO> findAgendas(Long admAgendaId) {
		return agendaAssembler.assemble(administradorDeAgendaDAO.findById(admAgendaId).getAgendas());
	}
	
	/*--------------------------------------------------------------------------------------*/
	/*---------------------------------- Geters and seters ---------------------------------*/

	public void setAdministradorDeAgendaDAO(AdministradorDeAgendaDAO administradorDeAgendaDAO) {
		this.administradorDeAgendaDAO = administradorDeAgendaDAO;
	}
	
	public void setAdministradorDeAgendaAssembler(AdministradorDeAgendaAssembler administradorDeAgendaAssembler) {
		this.administradorDeAgendaAssembler = administradorDeAgendaAssembler;
	}
	
	public void setAgendaAssembler(AgendaAssembler agendaAssembler) {
		this.agendaAssembler = agendaAssembler;
	}

	/*--------------------------------------------------------------------------------------*/

}
